package ch.rheintalconnection.sysventory.domain;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public final class ScanFactory {

	public ScanFactory() {
	}
	
	public static Scan getScanMock() throws UnknownHostException
	{
		Date startDate = new Date();
		Timestamp startTimestamp = new Timestamp(startDate.getTime());
		
		User user = new User("admin", "pass", 1);
		
		Client client = new Client("AA:BB:CC:DD:EE:FF");
		
		Computer computer = new Computer("comp1", 1000, "Desktop", 1000000, 100000);
		
		InetAddress ipv4 = InetAddress.getByName("127.0.0.1");
		InetAddress gateway = InetAddress.getByName("127.0.0.1");
		InetAddress dhcp = InetAddress.getByName("127.0.0.1");
		InetAddress subNet = InetAddress.getByName("127.0.0.1");
		NIC nic = new NIC(ipv4,"comp1", "AA:BB:CC:DD:EE:FF", gateway, dhcp, subNet);
		
		OperatingSystem os = new OperatingSystem("Windows 7", "1.0", "x64");
		
		Processor processor = new Processor("Intel i7", "Ivy Bridge", 4, "2.7 GHz");
		
		Printer printer = new Printer("Brother", "printdriver", "1.0");
		List<Printer> printers = new ArrayList<Printer>();
		printers.add(printer);
		
		Program program = new Program("Microsoft Word", "1.0");
		List<Program> programs = new ArrayList<Program>();
		programs.add(program);
		
		Date scanDate = new Date();
		Timestamp scanTimestamp = new Timestamp(scanDate.getTime());
		
		ScanEntry scanEntry = new ScanEntry(scanTimestamp, client, computer, nic, os, processor, printers, programs);
		List<ScanEntry> scanEntries = new ArrayList<ScanEntry>();
		scanEntries.add(scanEntry);
		
		Date endDate = new Date();
		Timestamp endTimestamp = new Timestamp(endDate.getTime());
		
		Scan scan = new Scan(startTimestamp, endTimestamp, user, scanEntries);
		
		return scan;
	}

}
